class TFConstructor extends TFWeapon;

var vector ProjSpawnOffset;

simulated function CustomFire()
{
    local Vector StartProj, StartTrace, X,Y,Z;
    local Rotator Aim;
	local UTGameObjective sgb;
	local tfpri pri;
	local tfgri gri;

    if(instigator == None)
           return;
    Instigator.MakeNoise(1.0);
    self.GetViewAxes(X,Y,Z);

    pri=tfpri(instigator.PlayerReplicationInfo);
    gri=tfgri(self.worldinfo.gri);

// //
    StartTrace=Instigator.Location+Instigator.GetPawnViewLocation();
    StartProj=StartTrace+X*ProjSpawnOffset.X+Y*ProjSpawnOffset.Y;

	Aim = GetAdjustedAim(StartProj);

    if(pri.RES>=100)
    {
        if(CheckControl(100, pri.team.teamindex, gri))
        {
            sgb=spawn(Class 'TaskForces.TFMinerals',instigator,,startproj,aim);
	        if(sgb!=none)
            {
	            pri.SubRES(100);
                return;
            }
        }
    }
}

function bool CheckControl(int costs, int team, gamereplicationinfo gri)
{

    if(gri!=none && tfgri(gri).control[team]+costs<=tfgri(gri).maxcontrol[team])
        return true;

    return false;
}


defaultproperties
{

//	ShotCost(0)=0

	MaxAmmoCount=3000

	FiringStatesArray(0)=WeaponFiring

	WeaponFireTypes(0)=EWFT_Custom

	FireInterval(0)=+2.0

	WeaponFireSnd(0)=none
	WeaponFireSnd(1)=none

	ProjSpawnOffset=(X=240.000000,Y=8.000000)

}
